import minappSdk from "minapp-sdk"
const BaaS = minappSdk

/**
 *
 * @param file 文件
 * @param categoryName 分类名称
 * @returns
 */
export const uploadFileBySDK = async (file: any, categoryName: string) => {
  let File = new BaaS.File()
  let fileParams = { fileObj: file }
  let metaData = { categoryName }
  console.log("接收到的 metaData:", categoryName) // 添加日志
  try {
    let res = await File.upload(fileParams, metaData)
    return { code: 0, data: { path: res.data.path }, message: "上传成功" }
  } catch (e) {
    return { code: 1, message: "上传失败", data: {} }
  }
}

export const uploadImg = () => {
  return ""
}

// 视频上传
export const uploadVideo = () => {
  return ""
}
